# Contributor: Oleg Titov <oleg.titov@gmail.com>
# Maintainer: Oleg Titov <oleg.titov@gmail.com>
pkgname=py3-blis
pkgver=0.4.2
pkgrel=0
pkgdesc="Fast matrix-multiplication as a self-contained Python library"
url="https://github.com/explosion/cython-blis"
arch="x86_64 x86"
license="MIT"
depends="python3"
makedepends="python3-dev py3-setuptools cython"
checkdepends="py3-pytest py3-hypothesis py3-numpy"
subpackages="$pkgname-doc"
source="blis-$pkgver.tar.gz::https://github.com/explosion/cython-blis/archive/v$pkgver.tar.gz"
options="!check" # Disable checks as py3-hypothesis 5.x is not supported
builddir="$srcdir/cython-blis-$pkgver"

prepare() {
	default_prepare
	case "$CARCH" in
		x86_64) BLIS_ARCH=x86_64 ;;
		x86) BLIS_ARCH=generic ;;
		aarch64) BLIS_ARCH=cortexa53 ;;
	esac
	export BLIS_ARCH
}

build() {
	python3 setup.py build_ext --inplace
}

check() {
	python3 setup.py install --root="$PWD/tmp_install"

	cd tmp_install/usr/lib/python3.8/site-packages

	PYTHONPATH="$PWD/build/lib" pytest-3 blis
}

package() {
	python3 setup.py install --prefix=/usr --root="$pkgdir"

	install -Dm644 README.md "$pkgdir/usr/share/doc/$pkgname/README.md"
}

sha512sums="d86016f4b0f27b16758d94258e471db0ee0b1fc4e078dfcf5230d9ac602936644380bbf1424372698e2fe5d919d9c9e06a583ce1e04a11f51615cec116f7e061  blis-0.4.2.tar.gz"
